6b7fb2
@@ -188,7 +188,11 @@
public class HFileWriterV3 extends HFileWriterV2 {
   
   protected void finishFileInfo() throws IOException {
     super.finishFileInfo();
-    if (hFileContext.isIncludesTags()) {
+    if (hFileContext.getDataBlockEncoding() == DataBlockEncoding.PREFIX_TREE) {
+      // In case of Prefix Tree encoding, we always write tags information into HFiles even if all
+      // KVs are having no tags.
+      fileInfo.append(FileInfo.MAX_TAGS_LEN, Bytes.toBytes(this.maxTagsLength), false);
+    } else if (hFileContext.isIncludesTags()) {
       // When tags are not being written in this file, MAX_TAGS_LEN is excluded
       // from the FileInfo
       fileInfo.append(FileInfo.MAX_TAGS_LEN, Bytes.toBytes(this.maxTagsLength), false);
